﻿<cfscript>
/** 
* ORM StudentBook
* 
* @hint "Hibernate persistenter t_student_book. 学生教材领用情况" 
* 
*/ 

component 
	displayname="public.service.orm.senate.StudentBook" 
	output=false 
	persistent=true 
	selectBeforeUpdate=true dynamicInsert=true dynamicUpdate=true 
	cacheuse="Transactional" 
	entityname="StudentBook" 
	table="t_student_book"
	{
	
	property type="string" name="PlanID" column="scbid" fieldtype="id" generator="assigned" hint="学生教材征订计划号";

	property type="string" name="isOut" column="is_out" hint="是否领用教材";
	property type="string" name="Description" column="describe" hint="备注";
	property type="string" name="BillCreateTime" column="opertime" hint="出单时间";

	property name="Student" fieldtype="many-to-one" fkcolumn="stu_id" cfc="Student"  hint="学生";
	property name="CourseBook" fieldtype="many-to-one" fkcolumn="cbid" cfc="CourseBook"  hint="教材征订计划";

	/**
	* @hint "自定义主键规则"
	* 
	* @Student "学生"
	* @CourseBook "教材征订计划"
	*/
	public string function getID( required Student, required CourseBook ) output=false {
		
		var nextID = arguments.Student.getStudentID() & "," & arguments.CourseBook.getCourseBookID();

		/* 
			主键生成规则 
			
			学生教材征订计划号21位 8位学号 , 12位教材选用编号

			Unique: STU_ID, CBID
		*/
		return nextID;
	}

}

</cfscript>